﻿//======================================================================
//
//        Copyright (C) 苏州逸仙软件    
//        All rights reserved
//
//        filename : book_page.cs
//        description :
//
//        created by 周济 at 2011/2/13 13:51:25
//        mail:80406241@qq.com
//
//======================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace huaguwang.virtualWeb.book
{
    public partial class book_page : System.Web.UI.Page
    {
        D_T_EBook_Exp _dtsc_exp = new D_T_EBook_Exp();
        virtualWeb.uc.book.book_tabs UC = new huaguwang.virtualWeb.uc.book.book_tabs();
        /// <summary>
        /// 查询的实现方法

        /// </summary>
        /// <param name="begin"></param>
        private List<M_Page> SetData(int begin)
        {
            //var dt = new List<M_Page>();
            var data = AdminPublic.Try<List<M_Page>>(() =>
            {
                WebPagerOne1.DataBind_HG(M_Page, _dtsc_exp.GetPage1Size(M_Type));
                //SetLiteral(_dtsc_exp.GetPage1Size(M_Type));
                var dt = _dtsc_exp.GetPage1(
                      (WebPagerOne1.HG_PageThis - 1) * WebPagerOne1.HG_PageSize,
                      WebPagerOne1.HG_PageSize,
                      M_Type,
                      m =>
                      {
                          UC.ToPage(ref m, 8, 30, 60, "地址１/file.aspx?id=", "地址１/file.aspx?id=");
                          return m;
                      }
                      );
                return dt;
            });
            return data;
        }

        /// <summary>
        /// 查询类型
        /// </summary>
        private int M_Type = 0;
        private int M_IsImage = 0;
        private int M_Page = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            M_Type = Request.Params["orderpage"].Exp_IntTryParse();
            M_Page = Request.Params["thispage"].Exp_IntTryParse();
            M_IsImage = Request.Params["isimg"].Exp_IntTryParse();


            Response.Clear();
            Response.ContentType = "text/plain";
            Response.Buffer = true;
            Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
            Response.Expires = 0;
            Response.CacheControl = "no-cache";
            Response.AddHeader("Pragma", "No-Cache");

            /*
            注意，目前还没有把排序的东西做起来。

             * 购买，等统计资料也没有做
            */

            var dt = SetData(0);
            if(M_IsImage > 0)
            {
                this.book_page_list1.Visible = false;
                this.book_page_image1.Visible = true;
                this.book_page_image1.M_Data = dt;
            }
            else
            {
                this.book_page_list1.Visible = true;
                this.book_page_image1.Visible = false;
                this.book_page_list1.M_Data = dt;
            }

        }
    }
}

